﻿
#region Imported Namespace

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Xml.Serialization;

#endregion

namespace TupleGeo.Emergency.CAP {

  /// <summary>
  /// <para>
  /// The container for all component parts of the area sub-element
  /// of the info sub-element of the alert message.
  /// </para>
  /// <para>
  /// The area segment describes a geographic area to which the <see cref="AlertInfo">info</see>
  /// segment in which it appears applies. Textual and coded descriptions (such as postal codes)
  /// are supported, but the preferred representations use geospatial shapes (polygons and circles)
  /// and an altitude or altitude range, expressed in standard latitude - longitude - altitude terms
  /// in accordance with a specified geospatial datum.
  /// </para>
  /// </summary>
  /// <remarks>
  /// <para>Optional.</para>
  /// <para>
  /// Multiple occurrences permitted, in which case the target area for the
  /// <see cref="AlertInfo">info</see> block is the union of all the included area blocks.
  /// </para>
  /// <para>
  /// It MAY contain one or multiple instances of
  /// <see cref="AlertInfoArea.Polygon">polygon</see>
  /// <see cref="AlertInfoArea.Circle">circle</see> or
  /// <see cref="AlertInfoArea.Geocode">geocode</see>.
  /// In such case the area described by this <area> block is
  /// represented by the union of all the included elements.
  /// </para>
  /// </remarks>
  [SerializableAttribute()]
  [DesignerCategoryAttribute("code")]
  [XmlTypeAttribute(TypeName = "alertInfoArea", AnonymousType = true, Namespace = "urn:oasis:names:tc:emergency:cap:1.2")]
  [DataContractAttribute(Name = "alertInfoArea", Namespace = "urn:oasis:names:tc:emergency:cap:1.2")]
  [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
  public partial class AlertInfoArea : EntityBase<AlertInfoArea> {

    #region Constructors - Destructors
    
    /// <summary>
    /// Initializes the AlertInfoArea.
    /// </summary>
    public AlertInfoArea() {
      this._geocode = new List<AlertInfoAreaGeocode>();
      this._circle = new List<string>();
      this._polygon = new List<string>();
    }

    #endregion

    #region Imported Namespaces

    private string _areaDesc;

    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "areaDesc", Order = 0)]
    [DataMemberAttribute(Name = "areaDesc", Order = 0)]
    public virtual string AreaDescription {
      get {
        return this._areaDesc;
      }
      set {
        if ((this._areaDesc != null)) {
          if ((_areaDesc.Equals(value) != true)) {
            this._areaDesc = value;
            this.OnPropertyChanged("AreaDescription");
          }
        }
        else {
          this._areaDesc = value;
          this.OnPropertyChanged("AreaDescription");
        }
      }
    }

    private List<string> _polygon;

    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "polygon", Order = 1)]
    [DataMemberAttribute(Name = "polygon", Order = 1)]
    public virtual List<string> Polygon {
      get {
        return this._polygon;
      }
      set {
        if ((this._polygon != null)) {
          if ((_polygon.Equals(value) != true)) {
            this._polygon = value;
            this.OnPropertyChanged("Polygon");
          }
        }
        else {
          this._polygon = value;
          this.OnPropertyChanged("Polygon");
        }
      }
    }

    private List<string> _circle;

    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "circle", Order = 2)]
    [DataMemberAttribute(Name = "circle", Order = 2)]
    public virtual List<string> Circle {
      get {
        return this._circle;
      }
      set {
        if ((this._circle != null)) {
          if ((_circle.Equals(value) != true)) {
            this._circle = value;
            this.OnPropertyChanged("Circle");
          }
        }
        else {
          this._circle = value;
          this.OnPropertyChanged("Circle");
        }
      }
    }

    private List<AlertInfoAreaGeocode> _geocode;

    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "geocode", Order = 3)]
    [DataMemberAttribute(Name = "geocode", Order = 3)]
    public virtual List<AlertInfoAreaGeocode> Geocode {
      get {
        return this._geocode;
      }
      set {
        if ((this._geocode != null)) {
          if ((_geocode.Equals(value) != true)) {
            this._geocode = value;
            this.OnPropertyChanged("Geocode");
          }
        }
        else {
          this._geocode = value;
          this.OnPropertyChanged("Geocode");
        }
      }
    }

    private decimal _altitude; // TODO: Type change in 1.2
    
    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "altitude", Order = 4)]
    [DataMemberAttribute(Name = "altitude", Order = 4)]
    public virtual decimal Altitude {
      get {
        return this._altitude;
      }
      set {
        if ((this._altitude != null)) {
          if ((_altitude.Equals(value) != true)) {
            this._altitude = value;
            this.OnPropertyChanged("Altitude");
          }
        }
        else {
          this._altitude = value;
          this.OnPropertyChanged("Altitude");
        }
      }
    }

    private bool _altitudeSpecified;

    /// <summary>
    /// 
    /// </summary>
    [XmlIgnoreAttribute()]
    [DataMemberAttribute(Name = "altitudeSpecified", Order = 5)]
    public virtual bool AltitudeSpecified {
      get {
        return this._altitudeSpecified;
      }
      set {
        if ((_altitudeSpecified.Equals(value) != true)) {
          this._altitudeSpecified = value;
          this.OnPropertyChanged("AltitudeSpecified");
        }
      }
    }

    private decimal _ceiling; // TODO: Type change in 1.2

    /// <summary>
    /// 
    /// </summary>
    [XmlElementAttribute(ElementName = "ceiling", Order = 5)]
    [DataMemberAttribute(Name = "ceiling", Order = 6)]
    public virtual decimal Ceiling {
      get {
        return this._ceiling;
      }
      set {
        if ((this._ceiling != null)) {
          if ((_ceiling.Equals(value) != true)) {
            this._ceiling = value;
            this.OnPropertyChanged("Ceiling");
          }
        }
        else {
          this._ceiling = value;
          this.OnPropertyChanged("Ceiling");
        }
      }
    }

    private bool _ceilingSpecified;

    /// <summary>
    /// 
    /// </summary>
    [XmlIgnoreAttribute()]
    [DataMemberAttribute(Name = "ceilingSpecified", Order = 7)]
    public virtual bool CeilingSpecified {
      get {
        return this._ceilingSpecified;
      }
      set {
        if ((_ceilingSpecified.Equals(value) != true)) {
          this._ceilingSpecified = value;
          this.OnPropertyChanged("CeilingSpecified");
        }
      }
    }

    #endregion

  }

}
